var limsEquiptBorrow = Gikam.getPageObject({

    getEditListColumns : function() {
        return [ {
            checkbox : true
        }, Gikam.status.getBpmnColumn(limsEquiptBorrow.workflow.dbTable), {
            field : 'id',
            title : 'T_LIMS_EQUIPT_BORROW.ID',
            type : 'link'
        },{
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE'
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME'
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY'
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE'
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON'
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG'
        }, {
            field : 'borrowLab',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLAB'
        }, {
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME'
        }, {
            field : 'createdTime',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDTIME',
            type : 'date'
        }, {
            field : 'createdByName',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDBYNAME',
        }];
    },

    getBaseInfoFormFields : function() {
        return [ {
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE',
            validators : ['notEmpty' ],
            type : 'choose',
            category : 'equiptChoose',
            preInsert: true,
            single : true,
            onBeforeChoose : function() {
              return {
                  // 过滤被借出的设备
                  equiptStatus_DIFFER: 'Borrow'
              }
            },
            onAfterChoose : function (rows) {
                    this.setData({
                        laboratory : null,
                    })
                if (!Gikam.isEmpty(rows)) {
                    this.setData({
                        equiptId : rows[0].id,
                        equiptCode : rows[0].equiptCode,
                        equiptName : rows[0].equiptName,
                        laboratory : rows[0].orgName,
                        laboratoryId : rows[0].orgId,
                        borrowPlace : rows[0].locName
                    })
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    equiptId : null,
                    equiptCode : null,
                    equiptName : null,
                    laboratory : null,
                    laboratoryId : null,
                    borrowPlace : null
                },true);
            }
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME',
            validators : [ 'strLength[0,80]' ,'notEmpty'],
            preInsert : true,
            readonly : true,
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY',
            preInsert: true,
            readonly: true
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE',
            validators : [ 'strLength[0,33]','notEmpty' ],
            preInsert: true,
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON',
            validators : [ 'strLength[0,166]' ],
            preInsert: true,
            type :'textarea',
            height : 100,
            colspan : 3
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG',
            preInsert: true,
            type : 'choose',
            validators: ['notEmpty'],
            category : 'org-simple',
            onBeforeChoose : function() {
                return {
                    single : true,
                }
            },
            onAfterChoose : function (rows,index) {
                if (Gikam.isNotEmpty(rows)) {
                    this.setData({
                        index : index,
                        borrowOrgId : rows[0].id,
                        borrowOrg : rows[0].orgName
                    },true);
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    borrowOrgId : null,
                    borrowOrg : null
                },true);
            }
        }, {
            field : 'borrowOrgId',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORGID',
            validators : [ 'strLength[0,20]' ]
        }, {
            field : 'borrowLab',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLAB',
            validators : [ 'notEmpty' ],
            type: 'choose',
            preInsert: true,
            category : 'org-simple',
            cleanable : false,
            onBeforeChoose : function() {
                return {
                    single : true,
                }
            },
            onAfterChoose : function (rows,index) {
                if (Gikam.isNotEmpty(rows)) {
                    this.setData({
                        index : index,
                        borrowLabId : rows[0].id,
                        borrowLab : rows[0].orgName
                    },true);
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    borrowLabId : null,
                    borrowLab : null
                },true);
            }
        }, {
            field : 'borrowLabId',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLABID',
            validators : [ 'strLength[0,20]' ]
        }, {
            field : 'borrowTestGroup',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTESTGROUP',
            validators : [ 'strLength[0,20]' ]
        }, {
            field : 'borrowTestGroupId',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTESTGROUPID',
            validators : [ 'strLength[0,20]' ]
        },{
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME',
            type : 'date',
            validators: ['notEmpty'],
            preInsert: true,
        } ];
    },
    getDetailBaseInfoFormFields : function() {
        return [ {
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE',
            validators : ['notEmpty' ],
            type : 'choose',
            category : 'equiptChoose',
            preInsert: true,
            single : true,
            onAfterChoose : function (rows) {
                if (!Gikam.isEmpty(rows)) {
                    this.setData({
                        equiptId : rows[0].id,
                        equiptCode : rows[0].equiptCode,
                        equiptName : rows[0].equiptName,
                        laboratory : rows[0].laboratory,
                        laboratoryId : rows[0].laboratoryId
                    })
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    equiptId : null,
                    equiptCode : null,
                    equiptName : null,
                    laboratory : null,
                    laboratoryId : null,
                },true);
            }
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME',
            validators : [ 'strLength[0,80]' ,'notEmpty'],
            preInsert : true,
            readonly : true,
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY',
            preInsert: true,
            readonly: true
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE',
            validators : [ 'strLength[0,33]','notEmpty' ],
            preInsert: true,
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON',
            validators : [ 'strLength[0,166]' ],
            preInsert: true,
            type :'textarea',
            height : 100,
            colspan : 3
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG',
            preInsert: true,
            type : 'choose',
            validators: ['notEmpty'],
            category : 'org-simple',
            onBeforeChoose : function() {
                return {
                    single : true,
                }
            },
            onAfterChoose : function (rows,index) {
                if (Gikam.isNotEmpty(rows)) {
                    this.setData({
                        index : index,
                        borrowOrgId : rows[0].id,
                        borrowOrg : rows[0].orgName
                    },true);
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    borrowOrgId : null,
                    borrowOrg : null
                },true);
            }
        }, {
            field : 'borrowLab',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLAB',
            validators : [ 'notEmpty' ],
            type: 'choose',
            preInsert: true,
            category : 'org-simple',
            cleanable : false,
            onBeforeChoose : function() {
                return {
                    single : true,
                }
            },
            onAfterChoose : function (rows,index) {
                if (Gikam.isNotEmpty(rows)) {
                    this.setData({
                        index : index,
                        borrowLabId : rows[0].id,
                        borrowLab : rows[0].orgName
                    },true);
                }
            },
            onClean : function (field, value, index) {
                this.setData({
                    index : index,
                    borrowLabId : null,
                    borrowLab : null
                },true);
            }
        }, {
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME',
            type : 'date',
            validators: ['notEmpty'],
            preInsert: true,
        }, {
            field : 'createdTime',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDTIME',
            readonly: true
        }, {
            field : 'createdByName',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDBYNAME',
            readonly: true
        }];
    },
    getAuditListColumns : function() {
        return [ {
            checkbox : true
        }, Gikam.status.getBpmnColumn(limsEquiptBorrow.workflow.dbTable), {
            field : 'id',
            title : 'T_LIMS_EQUIPT_BORROW.ID',
            type : 'link'
        },{
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE'
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME'
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY'
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE'
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON'
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG'
        }, {
            field : 'borrowLab',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLAB'
        }, {
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME'
        }, {
            field : 'createdTime',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDTIME',
            type : 'date'
        }, {
            field : 'createdByName',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDBYNAME',
        },];
    },

    getSearchListColumns : function() {
        return [ {
            checkbox : true
        }, Gikam.status.getBpmnColumn(limsEquiptBorrow.workflow.dbTable), {
            field : 'id',
            title : 'T_LIMS_EQUIPT_BORROW.ID',
            type : 'link'
        },{
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE'
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME'
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY'
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE'
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON'
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG'
        }, {
            field : 'borrowLab',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWLAB'
        }, {
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME'
        }, {
            field : 'createdTime',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDTIME',
            type : 'date'
        }, {
            field : 'createdByName',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDBYNAME',
        }];
    },
    getChooseListColumns : function () {
        return [  {
            field : 'equiptCode',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTCODE'
        }, {
            field : 'equiptName',
            title : 'T_LIMS_EQUIPT_BORROW.EQUIPTNAME'
        }, {
            field : 'laboratory',
            title : 'T_LIMS_EQUIPT_BORROW.LABORATORY'
        }, {
            field : 'borrowPlace',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWPLACE'
        }, {
            field : 'borrowReason',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWREASON'
        }, {
            field : 'borrowOrg',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWORG'
        }, {
            field : 'borrowTime',
            title : 'T_LIMS_EQUIPT_BORROW.BORROWTIME'
        }, {
            field : 'createdTime',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDTIME',
            type : 'date'
        }, {
            field : 'createdByName',
            title : 'T_LIMS_EQUIPT_BORROW.CREATEDBYNAME',
        }];
    },
    baseUrl : IFM_CONTEXT + '/secure/basemodule/trm/equipt/equipt-borrows',

    workflow : {
        dbTable : 'T_LIMS_EQUIPT_BORROW',
        columns : [ {
            field : 'id',
            title : 'T_LIMS_EQUIPT_BORROW.ID'
        } ]
    }

});
